package gui.panel;

import java.awt.BorderLayout;
import java.awt.Image;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import entity.Record;
import service.RecordService;
import util.ChartUtil;
import util.GUIUtil;

public class ReportPanel2 extends JPanel{
	static {
        GUIUtil.useLNF();
    }
 
    public static ReportPanel2 instance = new ReportPanel2();
 
    public JLabel l = new JLabel();
 
    public ReportPanel2() {
        this.setLayout(new BorderLayout());
        List<Record> rs = new RecordService().listThisMonthRecords();
        //List<Record> rs = new RecordService().query();
        Image i =ChartUtil.getImage(rs,900, 400);
        ImageIcon icon= new ImageIcon(i);
        l.setIcon(icon);
        this.add(l);
    }
 
    public static void main(String[] args) {
        GUIUtil.showPanel(ReportPanel2.instance);
    }
}
